#include<iostream>
#include<algorithm>
using namespace std;
#define MAXN 100002

int dat[MAXN],n;
int main()
{
    int i,r,l,m,big,small,mid,kth,cnt,v;
    while( scanf("%d",&n)!=-1 )
    {
        for( i=0 ; i<n ; i++ )
            scanf("%d",&dat[i]);
        sort( dat , dat+n );
        big = dat[n-1]-dat[0] , small = 0;
        kth = (n*(n-1)/2+1)>>1;
        while( small+1<big )
        {
            mid = (big+small)>>1;
            cnt = 0 ;
            for( i=0 ; i<n-1 ; i++ )
            {
                l = i+1 , r = n-1;
                if( dat[l]-dat[i]>mid )
                    continue;
                if( dat[r]-dat[i]<=mid )
                {
                    cnt += r-i;
                    continue;
                }
                while( l+1<r )
                {
                    m = (l+r)>>1;
                    if( dat[m]-dat[i]<=mid )
                        l = m;
                    else
                        r = m;
                }
                cnt += l-i;
            }
            if( cnt>=kth )
                big = mid;
            else
                small = mid;
        }
        printf("%d\n",big);
    }
}